package com.rain.controller;

import com.rain.enums.PageSize;
import com.rain.query.SimplePage;
import com.rain.query.ResponseVO
import com.rain.entity.EtTower;
import com.rain.query.EtTowerQuery;
import com.rain.query.PaginationResult;
import com.rain.service.EtTowerService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
/**
 * @auther: rain
 * @description: 输电塔Controller
 * @date: 2025-10-31
 */

@RestController
@RequestMapping("/etTower")
public class EtTowerController extends BaseController {

	@Resource
	private EtTowerService etTowerService;

	@GetMapping
	public ResponseVO list(EtTowerQuery query) {
		return getSuccessResponseVO(etTowerService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@PostMapping
	public ResponseVO add(EtTower bean) {

	return getSuccessResponseVO(etTowerService.add(bean));

	}

	/**
	 * 批量新增
	 */
	@PostMapping("/addBatch")
	public ResponseVO addBatch(List<EtTower> listBean) {

	return getSuccessResponseVO(etTowerService.addBatch(listBean));

	}

	/**
	 * 批量新增修改
	 */
	@PostMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(List<EtTower> listBean) {

	return getSuccessResponseVO(etTowerService.addOrUpdateBatch(listBean));

	}

	/**
	 * 根据Id查询
	 */
	@GetMapping("/{id}")
	public ResponseVO getEtTowerById(@PathVariable Integer id) {

		return getSuccessResponseVO(etTowerService.getEtTowerById(id));

	}

	/**
	 * 根据Id更新
	 */
	@PutMapping("/{id}")
	public ResponseVO updateEtTowerById(@RequestBody EtTower bean, @PathVariable Integer id){

		return getSuccessResponseVO(etTowerService.updateEtTowerById(bean, id));

	}

	/**
	 * 根据Id删除
	 */
	@DeleteMapping("/{id}")
	public ResponseVO deleteEtTowerById(@PathVariable Integer id) {

		return getSuccessResponseVO(etTowerService.deleteEtTowerById(id));

	}

}